import React, { BaseSyntheticEvent } from 'react';
import { ActivityIndicator, Text, View } from 'react-native';

export default function tpl(a: <T>(action: string, ...args: unknown[]) => ((ev: BaseSyntheticEvent<T>) => void), s: (...class_names: string[]) => {}, d: (d: string) => string | unknown[]) {
	const arr = d('data') as Array<{ teacher_name: string; teacher_no: string; auditor_status: string; leave_type: string; start_time: number; finish_time: number; leave_days: number; teacher_leave_content: string; reviewer: string; audit_opinion: string; start_time_str: string; finish_time_str: string; }>;
	if (arr && arr.length > 0) {

		return (<View style={{ height: '100%', backgroundColor: '#f4f4f4' }}>
			<View style={{ borderBottomColor: '#ddd', borderBottomWidth: 1, paddingLeft: 20, paddingRight: 20, backgroundColor: '#fff', marginTop: 20 }}>
				<Text style={{ color: '#333', height: 30, lineHeight: 30 }}>{arr[0].teacher_name}</Text>
				<Text style={{ height: 30, lineHeight: 30 }}>{arr[0].auditor_status}</Text>
			</View>
			<View style={{
				padding: 20, backgroundColor: '#fff',
				borderBottomColor: '#ddd', borderBottomWidth: 1
			}}>
				<View style={{ flexDirection: 'row', height: 30, lineHeight: 30 }}>
					<Text>请假类型：</Text>
					<Text>{arr[0].leave_type}</Text>
				</View>
				<View style={{ flexDirection: 'row', height: 30, lineHeight: 30 }}>
					<Text>开始时间：</Text>
					<Text>{arr[0].start_time_str}</Text>
				</View>
				<View style={{ flexDirection: 'row', height: 30, lineHeight: 30 }}>
					<Text>结束时间：</Text>
					<Text>{arr[0].finish_time_str}</Text>
				</View>
				<View style={{ flexDirection: 'row', height: 30, lineHeight: 30 }}>
					<Text>时长（天）：</Text>
					<Text>{arr[0].leave_days}</Text>
				</View>
				<View style={{ flexDirection: 'row', height: 30, lineHeight: 30 }}>
					<Text>请假事由：</Text>
					<Text>{arr[0].teacher_leave_content}</Text>
				</View>
			</View>
			<View style={{ borderBottomColor: '#ddd', paddingLeft: 20, paddingRight: 20, backgroundColor: '#fff' }}>
				<View style={{ flexDirection: 'row', height: 30, alignItems: "center" }}>
					<Text style={{}}>审批人：</Text>
					<Text>{arr[0].reviewer}</Text>
				</View>
				<View style={{ flexDirection: 'row', lineHeight: 30, marginBottom: 10 }}>
					<Text>审批意见：</Text>
					<Text style={{ paddingRight: 60 }}>{arr[0].audit_opinion}</Text>
				</View>
			</View>
		</View>);
	} else {
		return (
			<View style={s('footer1')}>
				<ActivityIndicator />
				<Text>正在加载数据...</Text>
			</View>
		);
	}

}
